﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GateAnd.cs" company="pwasiewicz">
//   pwasiewicz
// </copyright>
// <summary>
//   Defines the GateAnd type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace LogicSystem.LogicGates
{
    using System.Linq;

    /// <summary>The gate and.</summary>
    public class GateAnd : LogicGate
    {
        /// <summary>Initializes a new instance of the <see cref="GateAnd"/> class.</summary>
        internal GateAnd()
        {
        }

        /// <summary>
        /// Gets the latency.
        /// </summary>
        public override int Latency
        {
            get { return 5; }
        }

        /// <summary>
        /// Computes output wire state.
        /// </summary>
        /// <returns>The gate's state.</returns>
        public override bool ComputeOutput()
        {
            return this.InputWires.All(wire => wire.State);
        }
    }
}
